package com.ruoyi.service.jpjs.mainmaterial.impl;

import com.ruoyi.mapper.jpjs.mainmaterial.MainMaterialMapper;
import com.ruoyi.service.jpjs.mainmaterial.MainMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class MainMaterialServiceimpl implements MainMaterialService {

    @Autowired
    MainMaterialMapper mainMaterialMapper;

    @Override
    public List<Map<String, Object>> list(Map map) {
        return mainMaterialMapper.list(map);
    }

    @Override
    public int add(Map map) {
        return mainMaterialMapper.add(map);
    }

    @Override
    public Map<String, Object> findMainMaterialId(String id) {
        return mainMaterialMapper.findMainMaterialId(id);
    }

    @Override
    public int edit(Map map) {
        return mainMaterialMapper.edit(map);
    }

    @Override
    public List<Map<String, Object>> findProByCompId(String compId) {
        return mainMaterialMapper.findProByCompId(compId);
    }

    @Override
    public int remove(String ids) {
        String[] idSplit = ids.split(",");
        int num = 0;
        for (String id : idSplit) {
            num += mainMaterialMapper.remove(id);
        }
        return num;
    }
}
